package co.yixiang.yshop.module.product.enums.coupon;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author moxiangrong
 * 优惠券兑换码状态类型枚举
 */
@Getter
@AllArgsConstructor
public enum CouponCdKeyStatusEnum {
    DEL(-1, "已删除"),
    USE(0, "已兑换"),
    NO_USE(1, "未兑换");

    private Integer value;
    private String desc;
    public static CouponCdKeyStatusEnum toType(int type) {
        return Stream.of(CouponCdKeyStatusEnum.values())
                .filter(p -> p.value.equals(type))
                .findAny()
                .orElse(null);
    }
}
